using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Wrath.Windows.Forms;
using Wrath.Xml;
using Wrath.RuleForge.Interfaces;

namespace Wrath.RuleForge.Property
{
    public partial class PropertyForm<WrapperType> : DockContent
    {
        private IPropertyWrapper<WrapperType> wrapper;

        public IPropertyWrapper<WrapperType> Wrapper
        {
            get { return wrapper; }
            set 
            { 
                wrapper = value;
                propertyGrid.SelectedObject = wrapper;
            }
        }

        public PropertyForm()
        {
            InitializeComponent();
        }

        private void propertyGrid_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
        {
            EventBroker.FireElementPropertyChanged(((IPropertyWrapper<Element>)propertyGrid.SelectedObject).Data);
        }
    }
}